# -*- coding: utf-8 -*-

from django.http import HttpResponse
from TestModel.models import Test
 
def testdb(request):
    # return HttpResponse("Hello world ! ")
    test1 = Test(name='runoob')
    test1.save()
    return HttpResponse('<p>数据添加成功！</p>')
def getList(request):

    #select * from 
    #response = Test.objects.all()

    #where
    #response1 = Test.objects.filter(status=1)

    #find
    #response2 = Test.objects.get(id=1)
    
    '''
    #offset 0 limit 2
    order_by('name')[0:2]
    order_by('id')
    #可以连锁使用
    Test.objects.filter(name='runoob').order_by('id')
    '''

    #输出数据
    # for var in list:
    #     response1 += var.name + ""
    # response = response1
    # return HttpResponse("<p>" + response + "</p>")

def search(request):
    request.encoding='utf-8'
    if 'q' in request.GET:
        message = '你搜索的内容： '+ request.GET['q']
    else:
        message = '你搜索的内容：'  
   
    return HttpResponse(request.get())
    





